package cn.quevo.cube.provide.define.validate.tools;

import cn.quevo.common.utils.EntityUtil;
import cn.quevo.cube.provide.define.entity.CubeColumnExt;
import cn.quevo.cube.provide.define.entity.dto.CubeColumnDto;

public class ColumnExtTool {

    /**
     * 构造CubeColumnExt
     *
     * @param cubeColumnDto
     * @param label
     * @param name
     * @param value
     * @return
     */
    public static CubeColumnExt initCubeColumnExt(CubeColumnDto cubeColumnDto, String label, String name, String value) {
        CubeColumnExt cubeColumnExt = new CubeColumnExt();
        EntityUtil.init(cubeColumnDto, cubeColumnExt);
        cubeColumnExt.setModelId(cubeColumnDto.getModelId());
        cubeColumnExt.setColumnId(cubeColumnDto.getId());
        cubeColumnExt.setExtLabel(label);
        cubeColumnExt.setExtName(name);
        cubeColumnExt.setExtVal(value);
        cubeColumnDto.getExts().put(name, cubeColumnExt);
        return cubeColumnExt;
    }
}
